package per.lance.easytomcat.mapper;

import per.lance.easytomcat.handler.Handler;
import per.lance.easytomcat.handler.DynamicHandler;
import per.lance.easytomcat.handler.StaticHandler;
import per.lance.easytomcat.net.HttpRequest;
import per.lance.easytomcat.net.HttpRespone;

public class HandlerMapping {

    public Handler mapping(HttpRequest httpRequest, HttpRespone httpResponse) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        String filePath = httpRequest.getUri().getPath();
        if (filePath.contains(".")) {
            return new StaticHandler();
        } else {
            return new DynamicHandler();
        }
    }
}
